package data;

import java.util.List;

import bo.BusinessFigure;
/**
 * this class can calculate the scales for revenue and profit
 * @author Simon Korteweg
 * @author Nikolai Straessle
 *
 */
public class ScaleCalculate {
	
	/**
	 * calculate the yScale for revenue
	 * @param aList
	 * 		java.util.List<BusinessFigure>
	 * @return
	 * 		Double
	 */
	public double yScaleRevenue(List<BusinessFigure> aList){
		double highest = aList.get(0).getaRevenue();
		for (BusinessFigure businessFigure : aList) {
			if(businessFigure.getaRevenue() > highest){
				highest = businessFigure.getaRevenue();
			}
		}
		return highest + (aList.get(0).getaRevenue() / 2);
	}
	
	/**
	 * calculate the yScale for profit
	 * @param aList
	 * 		java.util.List<BusinessFigure>
	 * @return
	 * 		Double
	 */
	public double yScaleProfit(List<BusinessFigure> aList){
		double highest = aList.get(0).getaProfit();
		for (BusinessFigure businessFigure : aList) {
			if(businessFigure.getaProfit() > highest){
				highest = businessFigure.getaProfit();
			}
		}
		return highest + ( aList.get(0).getaProfit()/2);
	}

}
